<template>
	<view class="content">
		<view class="">
			<view class="devices">
				<view class="dev_num">
					设备总数：450
				</view>
				<view class="dev_status" @click="cshow">
					<view class="dev_use">
						<image class="maxiconSize" src="@/static/device/wxzhengchangshiyong.svg" mode=""></image> 正常使用
					</view>
					<view class="">
						>
					</view>
				</view>
			</view>
			<view class="dev_down">
				<image src="@/static/device/g-ningmeng.svg" mode=""></image>
				<text>设备列表 | 向下滑动显示更多 </text>
			</view>
		</view>
		<view class="dev_list" v-if="true">
			<mescroll-body class="water_scroll" ref="mescrollRef" @init="mescrollInit" :down="downOption"
				@down="downCallback" @up="upCallback">
				<view class="dev_item" v-for="item in 20" :key="item" @click="navTo('/pages/device/info')">
					<view class="intro">
						<view class="in_tle">F300前准备部分 | DEV2021000191</view>
						<view class="in_size"><text>规格型号：</text>FYF-200RE-1022</view>
						<view class="in_size"><text>负责人：</text>王阳明</view>
						<view class="in_status"><text class="so">C(一般)</text><text class="matter">B(重要)</text><text
								class="master">A(关键)</text><text class="very">特</text>
							<image src="@/static/navigation/维保 (2).png" mode=""></image>
						</view>
					</view>
					<view class="img">
						<image src="@/static/device/shebei.png" mode=""></image>
						</view>
			</view>
			</mescroll-body>
		</view>
		<u-select value-name="value" cancel-color="#999999" confirm-color="#0581fd" label-name="label" v-model="show"
			:list="list" @confirm="confirm"></u-select>
	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	export default {
		mixins: [MescrollMixin], // 使用mixin
		data() {
			return {
				show: false,
				list: [{
						value: '1',
						label: '江'
					},
					{
						value: '2',
						label: '湖'
					}
				],
				downOption: {
					auto: false //是否在初始化后,自动执行downCallback; 默认true
				},
			};
		},
		mounted() {},
		methods: {
			cshow() {
				console.log('001')
				this.show = true
			},

			confirm(e) {
				console.log(e)
			},
			/*下拉刷新的回调 */
			downCallback() {
				let that = this
				return
				//联网加载数据
				this.apis.materialsApi.maMaterialList({
					pageNum: 1,
					pageSize: 10,
					category: this.dictValue,
					materialName: this.materialName
				}).then(res => {
					this.materList = res.rows
					this.mescroll.endBySize(res.rows.length, res.total)
				}).catch(() => {
					//联网失败的回调,隐藏下拉刷新的状态
					this.mescroll.endErr();
				})
			},
			/*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
			upCallback(page) {
				//联网加载数据
				return
				this.apis.materialsApi.maMaterialList({
					pageNum: 1,
					pageSize: 10,
					category: this.dictValue,
					materialName: this.materialName
				}).then(res => {
					this.materList = this.materList.concat(res.rows);
					this.mescroll.endBySize(res.rows.length, res.total)

				}).catch(() => {
					//联网失败的回调,隐藏下拉刷新的状态
					this.mescroll.endErr();
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@mixin maxIconSize {
		width: 40rpx;
		height: 40rpx;
	}

	.content {
		background: #fafafa;
		position: relative;

		.devices {
			z-index: 9;
			width: 100%;
			position: fixed;
			height: 114rpx;
			background-color: $bodyColor;
			box-sizing: border-box;
			padding: 0 30rpx;

			.dev_num {
				font-size: 24rpx;
				color: #FFFFFF;
			}

			.dev_status {
				width: 92%;
				position: fixed;
				margin-top: 30rpx;
				@include box_shadow;
				border-radius: 80rpx;
				color: $bodyColor;
				background: #ffffff;
				padding: 18rpx 30rpx;
				box-sizing: border-box;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.dev_use {
					font-size: 28rpx;
					display: flex;
					align-items: center;

					image {
						@include maxIconSize;
						margin-right: 20rpx;
					}
				}
			}
		}

		.dev_list {
			overflow: hidden;
			box-sizing: border-box;
			padding: 0 20rpx;
			padding-top: 260rpx;
			display: flex;
			flex-direction: column;

			.dev_item {
				z-index: -1;
				display: flex;
				justify-content: space-between;
				align-items: center;
				border-radius: 24rpx;
				background: #FFFFFF;
				box-sizing: border-box;
				padding: 10rpx 0rpx 0rpx 20rpx;
				margin-bottom: 20rpx;

				image {
					width: 200rpx;
					height: 200rpx;
				}

				.intro {
					view {
						margin-bottom: 18rpx;
					}

					.in_tle {
						font-size: 28rpx;
						color: $bodyColor;
					}

					.in_size {
						font-size: 24rpx;
						color: #101010;

						text {
							color: #AEAEAE;
						}
					}

					.in_status {
						display: flex;
						align-items: center;

						text {
							font-size: 24rpx;
							display: inline-block;
							border-radius: 4rpx;
							background: #5FB878;
							padding: 2rpx;
							color: #FFFFFF;
							margin-right: 10rpx;
						}

						// 一般
						.so {
							background: #5FB878;
						}

						// 重要
						.matter {
							background: #813edb;
						}

						// 关键
						.master {
							background: #ff5722;
						}

						// 在用
						.use {
							background: #78bf34;
						}

						// 正常
						.normo {
							background: #358aef;
						}

						// 闲置
						.idle {
							background: #4abf94;
						}

						// 故障
						.fault {
							background: #e83672;
						}

						// 禁用
						.disable {
							background: #9da1a7;
						}

						// 带病运行
						.spite {
							background: #f0ad4e;
						}

						// 出租
						.out {
							background: #42b1e8;
						}

						image {
							@include miniIconSize;
						}

						.very {
							background: #FC8FA0;
							width: 36rpx;
							height: 36rpx;
							// padding: 2rpx;
							border-radius: 18rpx;
							text-align: center;
							line-height: 30rpx;
						}
					}
				}
			}
		}

		.dev_down {
			z-index: 8;
			width: 100%;
			position: fixed;
			display: flex;
			align-items: center;
			font-size: 24rpx;
			background: #fafafa;
			color: #AEAEAE;
			padding: 180rpx 20rpx 20rpx 20rpx;

			image {
				@include maxIconSize;
				margin-right: 20rpx;
			}
		}
	}
</style>
